package com.login.action;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;

import org.apache.log4j.Logger;

import com.common.util.BaseAction;
import com.login.action.fo.ManageFinaMoneyFO;
import com.login.service.IManagingFinancialMoneyServ;

public class ManagFinaMoneyAction extends BaseAction {
	public static Logger log = Logger.getLogger(ManagFinaMoneyAction.class);
	private ManageFinaMoneyFO fo;
	private String name;
	private int mixVal;
	private int maxVal;

	private IManagingFinancialMoneyServ servMoney;
	private int page;
	private int rows;
	private int total;
	
	public String deleteByIds() throws IOException {
		try {
			String ids = request.getParameter( "ids");
			boolean isFlag =servMoney.deleteByIdString(ids);
			response.setContentType("text/html;charset=utf-8");
			if (isFlag)
				message = "删除成功";
			else
				message = "删除失败";
			StringBuffer sb = new StringBuffer("[");
			sb.append("{\"message\":\"" + message + "\"" + "}");
			sb.append("]");
			this.response.getWriter().print(sb.toString());
		} catch (Exception e) {
			log.error("delete menulist error", e);
		}
		return null;
	}
	
	public String searchFinaList() {
		String result = servMoney.searchFinaList();
		PrintWriter out =null;
			try {
				 out = response.getWriter();
				response.setCharacterEncoding("utf-8");
				out.write(result);

			} catch (IOException e) {
				log.error("search fina error", e);
			}
		//	return "success"; 不能这样返回  引起前台页面数据展现不出来		
			return null;
		}
	
	/**
	 * 保存前台菜单
	 * 
	 * @return
	 */
	public String addSaveFina() {
		Map<String, Object> paraMap = new HashMap<String, Object>();
		paraMap.put("name", name);
		paraMap.put("mixVal", mixVal);
		paraMap.put("maxVal", maxVal);
		servMoney.saveSysmenu(paraMap);
		return "success";
	}	

	public ManageFinaMoneyFO getFo() {
		return fo;
	}

	public void setFo(ManageFinaMoneyFO fo) {
		this.fo = fo;
	}

	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}

	public int getPage() {
		return page;
	}
	public void setPage(int page) {
		this.page = page;
	}
	public int getRows() {
		return rows;
	}
	public void setRows(int rows) {
		this.rows = rows;
	}
	public int getTotal() {
		return total;
	}
	public void setTotal(int total) {
		this.total = total;
	}

	public void setServMoney(IManagingFinancialMoneyServ servMoney) {
		this.servMoney = servMoney;
	}

	
	

}
